package org.jeecg.modules.online.cgform.converter.impl;

import com.alibaba.fastjson.JSONObject;
import org.jeecg.modules.online.cgform.components.LinkDown;
import org.jeecg.modules.online.cgform.converter.channel.ConfigConvert;
import org.jeecg.modules.online.cgform.entity.OnlCgformField;

import java.util.HashMap;
import java.util.Map;

/**
 * 级联下拉
 */
public class LinkDownConverter extends ConfigConvert {

    private String linkField;

    public String getLinkField() {
        return linkField;
    }

    public void setLinkField(String linkField) {
        this.linkField = linkField;
    }

    public LinkDownConverter(OnlCgformField onlCgformField){
        super();
        String dictTable = onlCgformField.getDictTable();
        LinkDown linkDown = JSONObject.parseObject(dictTable, LinkDown.class);
        this.setTable(linkDown.getTable());
        this.setCode(linkDown.getKey());
        this.setText(linkDown.getTxt());
        this.linkField = linkDown.getLinkField();
    }

    @Override
    public Map<String, String> getConfig() {
        Map<String,String> map = new HashMap<String,String>();
        map.put("linkField",linkField);
        return map;
    }
}

